-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support optional resultset metadata #1150
base: master
Are you sure you want to change the base?
Support optional resultset metadata #1150
Conversation
d9cf63e
to
46e70d0
Compare
21f614e
to
38aa54a
Compare
Not really sure why seems this test is flaky in OSX travis
|
51e4ca4
to
b819a69
Compare
README.md
Outdated
|
||
Allow resultset metadata being optional. | ||
By making resultset metadata transfer being optional, can potentially improve queries performance. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document that this requires MySQL 8.0+.
Add link to MySQL documentation: https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_resultset_metadata
dsn.go
Outdated
@@ -465,6 +470,18 @@ func parseDSNParams(cfg *Config, params string) (err error) { | |||
return errors.New("invalid bool value: " + value) | |||
} | |||
|
|||
// allow resultset metadata being optional | |||
case "resultSetMetadata": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a mysql variable resultset_metadata
already exists, it would be better to use it (like time_zone
).
connector.go
Outdated
@@ -129,6 +129,24 @@ func (c *connector) Connect(ctx context.Context) (driver.Conn, error) { | |||
mc.maxWriteSize = mc.maxAllowedPacket | |||
} | |||
|
|||
// Additional handling for result set optional metadata | |||
if mc.cfg.ResultSetMetadata != "" { | |||
err = mc.exec("SET resultset_metadata=" + mc.cfg.ResultSetMetadata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleParams
sends all SET
at once. It would be better to use that. See also my remark about the option name.
dsn.go
Outdated
Timeout time.Duration // Dial timeout | ||
ReadTimeout time.Duration // I/O read timeout | ||
WriteTimeout time.Duration // I/O write timeout | ||
ResultSetMetadata string // Allow optional resultset metadata |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed if handled il Params
like other MySQL variables.
errors.go
Outdated
ErrPktTooLarge = errors.New("packet for query is too large. Try adjusting the 'max_allowed_packet' variable on the server") | ||
ErrBusyBuffer = errors.New("busy buffer") | ||
ErrNoOptionalResultSet = errors.New("requested optional resultset metadata but server does not support") | ||
ErrOptionalResultSetPkt = errors.New("malformed optional resultset metadata packets") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those variable should contain Metadata
in the name, because that's not the resultset which is optional but just the metadata.
cb6c794
to
acbdeec
Compare
Allow optional resultset metadata. Can potentially improve the performance in many scenarios. Issue go-sql-driver#1105
acbdeec
to
0b7ff91
Compare
Allow optional resultset metadata.
Can potentially improve the performance in many scenario.
Issue #1105
Note
I believe this flag was introduced in MySQL 8.0+ only.
Some open questions are:
maybeSkip
.Need your feedback on this, thank you!
Description
Add support optional resultset metadata.
Checklist